package com.xyzwps.server.paimon.ui.view

import com.fasterxml.jackson.annotation.JsonIgnore
import com.xyzwps.server.paimon.model.entity.Article
import com.xyzwps.server.paimon.value.UserId
import kotlin.time.Instant


data class ArticleView(
    @field:JsonIgnore
    val id: Long? = null,
    val uid: String? = null,
    @field:JsonIgnore
    val userId: UserId? = null,
    val title: String? = null,
    val content: String? = null,
    val createdAt: Instant? = null,
    val author: SimpleUserView? = null,
) {

    constructor(article: Article, author: SimpleUserView? = null) : this(
        id = article.id,
        uid = article.uid,
        userId = article.userId,
        title = article.title,
        content = article.content,
        createdAt = article.createdAt,
        author = author
    )
}
